import wx
import wx.lib.scrolledpanel
from PanelTracker import PanelTracker

# this is used to keep track of panels that have been created
panels = PanelTracker()

class BasePanel(wx.lib.scrolledpanel.ScrolledPanel):
    '''Base class for all panels in the UI'''

    # subclasses can set this to the panel id of some other panel (not
    # just any panel, but one that can contain other panels such as
    # rwb.core.shelf_notebook)
    container = None

    def __init__(self, window, *args, **kwargs):
        super(BasePanel, self).__init__(window, *args, **kwargs)
        self.window = window
        self.app = wx.GetApp()
        panels.track(self)

    def __del__(self):
        panels.forget(self)

